package io.renren.modules.project.controller;

import java.util.Arrays;
import java.util.Map;
import java.util.List;

import io.renren.common.annotation.SysLog;
import io.renren.modules.project.vo.ScoreRequestVoEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.project.entity.QulaityMarkScoreEntity;
import io.renren.modules.project.service.QulaityMarkScoreService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 质量打分记录表
 *
 * @author ygg
 * @date 2022-03-31 16:11:34
 */
@RestController
@RequestMapping("project/markscore")
public class QulaityMarkScoreController {
    @Autowired
    private QulaityMarkScoreService qulaityMarkScoreService;

    /**
     * 分页查询
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params){
        PageUtils page = qulaityMarkScoreService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        List<QulaityMarkScoreEntity> list = qulaityMarkScoreService.queryList(params);

        return R.ok().put("list", list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		QulaityMarkScoreEntity qulaityMarkScore = qulaityMarkScoreService.selectById(id);

        return R.ok().put("qulaityMarkScore", qulaityMarkScore);
    }

    /**
     * 保存
     */
    @SysLog("保存评分列表")
    @RequestMapping("/saveList")
    public R saveList(@RequestBody ScoreRequestVoEntity scoreVo){
		qulaityMarkScoreService.saveList(scoreVo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody QulaityMarkScoreEntity qulaityMarkScore){
		qulaityMarkScoreService.updateById(qulaityMarkScore);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		qulaityMarkScoreService.deleteBatch(ids);

        return R.ok();
    }

}
